package de.itkosmopolit.fixtures;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

import com.epam.kulibaba.test.TestBase;

import java.util.List;

public class TestGooglePageTitle{
  public TestGooglePageTitle() {		
	}
private String text;
  private String pageTitle;
   
  public void table(List<List<String>> table) throws InterruptedException{
        // Create a new instance of the html unit driver
        // Notice that the remainder of the code relies on the interface, 
        // not the implementation.
    WebDriver driver = new FirefoxDriver();
 
        // And now use this to visit Google
        driver.get("http://www.google.com");
 
        // Find the text input element by its name
        WebElement element = driver.findElement(By.name("q"));
 
        // Enter something to search for
        element.sendKeys("Cheese!");
 
        // Now submit the form. WebDriver will find the form for us from the element
        element.submit();
 
        // Check the title of the page
        pageTitle = driver.getTitle();
         
        driver.quit();
         
        Thread.sleep(500);
  }
  public TestGooglePageTitle(String text, String pageTitle) {
	super();
	this.text = text;
	this.pageTitle = pageTitle;
}
public void setTextInTitle(String text) {this.text = text;}
  public String isTitleCorrect() { 
        if (pageTitle.contains(text)) return "yes"; 
        else return "no";
  }
}